package cn.tedu.spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class User {
    //想要表示两个类之间的依赖关系 di把对方当成成员变量
    @Autowired
    Dept dept;

    String name = "jack";

    @Override
    public String toString() {

        System.out.println(dept.name);
        dept.toString();
        return "User{" +
                "dept=" + dept +
                ", name='" + name + '\'' +
                '}';
    }
}
